package pers.hwh.testredisson.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 * @Author: Wenhao Huang
 * @Date: 2025/3/5 16:41
 * @Version: 1.0
 * @Description:
 */
@Configuration
public class RedissonConfig {
	@Value("${spring.redis.host}")
	private String redisHost;

	@Value("${spring.redis.port}")
	private String port;

	@Bean
	public RedissonClient getRedisson() {
		Config config = new Config();
		config.useSingleServer().setAddress("redis://" + redisHost + ":" + port);
		return Redisson.create(config);
	}
}